package com.key.mapper;

import com.key.common.dto.ClearFormFindDTO;
import com.key.common.vo.AssetsVO;
import com.key.common.vo.ClearFormVO;
import com.key.entity.ClearForm;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author wei
 * @create 2023-02-22 9:58
 */
public interface ClearFormMapper {

    //################对clear_form的操作################

    /**
     * 添加报废清理表
     * @param clearForm
     * @return
     */
    int insertClearForm(ClearForm clearForm);

    /**
     * 删除报废清理表
     * @param cfNo
     * @return
     */
    int deleteClearFormByCfNo(@Param("cfNo") String cfNo);

    /**
     * 更新保费清理表
     * @param clearForm
     * @return
     */
    int updateClearForm(ClearForm clearForm);

    /**
     * 查询报废清理表，含高级搜素
     * @param clearFormFindDTO
     * @return
     */
    List<ClearForm> selectClearForm(ClearFormFindDTO clearFormFindDTO);

    /**
     * 查询报废清理表数量
     * @param clearFormFindDTO
     * @return
     */
    Integer getClearFormCount(ClearFormFindDTO clearFormFindDTO);

    /**
     * 根据单号查询保费清理表信息
     * @param cfNo
     * @return
     */
    ClearFormVO selectClearFormByCfNo(@Param("cfNo") String cfNo);

    List<ClearForm> selectEndClearFormList();

    //###############对assets_clear的操作###############

    /**
     * 添加报废清理和资产的关系表
     * @param cfNo
     * @param assetsId
     * @return
     */
    int insertAssetsClear(@Param("cfNo") String cfNo, @Param("assetsId") Long assetsId);

    /**
     * 删除报废清理和资产的关系表
     * @param cfNo
     * @return
     */
    int deleteAssetsClearByCfNo(@Param("cfNo") String cfNo);



    //###################联表操作####################

    /**
     * 根据单号查询报废清理表的资产
     * @param cfNo
     * @return
     */
    List<AssetsVO> selectAssetsByCfNo(@Param("cfNo") String cfNo);

    /**
     * 根据单号将清单下的所有资产的状态设置为已清理
     * @param cfNo
     * @return
     */
    int updateAssetsState(@Param("cfNo") String cfNo);
}
